package com.itheima.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class DemoController {

    @RequestMapping("/hello")
    public String sayHello(){
        System.out.println("恭喜你访问到我了");
        return "success";
    }

    @RequestMapping("/hello1")
    public ModelAndView method(){
        ModelAndView mv = new  ModelAndView();
        //mv.setViewName("success");//视图名称 支持逻辑视图 支持物理视图
        mv.setViewName("forward:/success");//视图名称 支持逻辑视图 支持物理视图
        mv.addObject("msg" , "xxxxx");//模型数据 相当于 request.setAttribute( key ,  value);
        System.out.println("hello world");
        return mv;

    }
}
